package com.xmb.common.controller.internal;

import com.xmb.common.entity.XmbRankConfig;
import com.xmb.common.service.RankConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by lyndon on 2019/4/10.
 */
@RestController
@RequestMapping(value = "/order/rank")
public class ActivityRankConfigController {

    @Autowired
    private RankConfigService rankConfigService;

    /**
     * 增加排行榜配置信息
     * @param
     */
    @PostMapping(value = "saveRankConfig")
    public int saveRankConfig(@RequestBody XmbRankConfig rankConfig){
        return rankConfigService.saveRankConfig(rankConfig);
    }

    /**
     * 修改排行榜配置信息
     * @param
     */
    @PostMapping(value = "updateRankConfig")
    public int updateRankConfig(@RequestBody XmbRankConfig rankConfig){
        return rankConfigService.updateRankConfig(rankConfig);
    }

    /**
     * 获取排行榜配置信息
     * @param
     */
    @GetMapping(value = "findRankConfig/{senceId}/{senceType}")
    public List<XmbRankConfig> findRankConfig(@PathVariable("senceId")Long senceId, @PathVariable("senceType")String senceType){
        return rankConfigService.findRankConfig(senceId,senceType);
    }

    /**
     * 删除排行榜配置信息
     * @param
     */
    @PutMapping(value = "deleteRankConfig/{id}")
    public int deleteRankConfig(@PathVariable("id")Long id){
        return rankConfigService.deleteXmbOrderRewardSetting(id);
    }

}
